<template>
	<view class="topdetail-container">
		<view>{{this.title}}</view>
		<view class="topdetail-content" v-for="(item,i) in this.content" :key="i">
			<uni-link :href="item.href">排名{{item.index}}: 内容:{{item.title}} 热度:{{item.hot}}</uni-link>
		</view>
	</view>
</template>

<script>
	import service from '../../utils/http.js'
	export default {
		data() {
			return {
				title: '',
				content: ''
			};
		},
		onLoad(option) {
			this.title = option.title
			this.getTopSearch()
		},
		methods: {
			getTopSearch() {
				service.get('/api/common/HotList')
					.then(response => {
						if (response.code === 200) {
							const result = response.result
							this.content = result[this.title]
						}
					})
					.catch(error => {
						console.error(error);
					});
			}
		}
	}
</script>

<style lang="scss">
.topdetail-container{
	margin-left: 100px;
	margin-top: 10px;
	line-height: 30px;
}
</style>